{include file="public/toper"/}
<style>
    .table_td {text-align: center;}
    .table_p {height: 20px;}
    .layui-table {width: 50%;margin: 0 auto;text-align: center;}
    .tis {margin-left: 21%;}
    .color{color: #FF0000}
</style>

<div class="x-body">
    <table class="layui-table">
        <p class="tis">基本信息</p>
        <tr>
            <td>状态：<span class="color">{if condition="$list['state'] eq 0"}申请中{elseif condition="$list['state'] eq 1"/}审核通过{elseif  condition="$list['state'] eq 2"/}审核失败{elseif  condition="$list['state'] eq 3"/}提现成功{elseif  condition="$list['state'] eq 4"/}提现失败{/if}</span></td>
            <td>用户：{$list['name']}【<span id="dh">{$list['phone']}</span>】</td>
        </tr>
        <tr>
            <td>注册时间：{$list['time']|date="Y-m-d H:i:s",###}</td>
            <td>申请时间：{$list['add_time']|date="Y-m-d H:i:s",###}</td>
        </tr>
        <tr>
            <td>提现金额：<span class="color">￥{$list['money']}</span></td>
            <td>手续费：<span class="color">￥{$list['poundage']}</span></td>
        </tr>
    </table>

    {if condition="$list['s_name'] neq ''"}
    <p class="table_p"></p>
    <table class="layui-table">
        <p class="tis">审核信息</p>
        <tr>
            <td>审核人：{$list['s_name']}</td>
            <td>审核结果：{if condition="$list['state'] eq 0"}申请中{elseif condition="$list['state'] eq 1"/}审核通过{elseif  condition="$list['state'] eq 2"/}审核失败{elseif  condition="$list['state'] eq 3"/}审核通过{elseif  condition="$list['state'] eq 4"/}审核通过{/if},原因：{$list['results']}</td>
        </tr>
        <tr>
            <td>审核时间：{$list['audit_time']|date="Y-m-d H:i:s",###}</td>
        </tr>
    </table>
    {/if}

    {if condition="$list['state'] eq 3"}
    <p class="table_p"></p>
    <table class="layui-table">
        <p class="tis">支付信息</p>
        <tr>
            <td>支付人：{$list['payer']}</td>
            <td>支付结果：{$list['pay_results']}</td>
        </tr>
        <tr>
            <td>支付渠道：{$list['pay_channel']}</td>
            <td>交易流水：{$list['pay_serial_number']}</td>
        </tr>
        <tr>
            <td>支付时间：{$list['pay_time']}</td>
        </tr>
    </table>
    {/if}

    {if condition="$list['state'] eq 0 || $list['state'] eq 2"}
    <p class="table_p"></p>
    <p class="tis">审核</p>
    <form action="" method="post" class="layui-form" id="formc">
        <input type="hidden" name="withdrawal_id" value="{$list['withdrawal_id']}" class="layui-input">
        <input type="hidden" name="withdrawal_type" value="1" class="layui-input">
        <div class="layui-form-item" style="width: 50%;margin: 0 auto;">
            <input type="radio" name="state" value="1" title="审核通过">
            <input type="radio" name="state" value="2" title="审核失败" checked>
        </div>
        <div class="layui-form-item" style="width: 50%;margin: 0 auto;">
            <input type="text" value="" name="results" required="" lay-verify="required" autocomplete="off"  class="layui-input">
        </div>
        <div class="layui-form-item" style="width: 50%;margin: 0 auto;">
            <button  class="layui-btn" lay-filter="formlog" lay-submit="">提交</button>
        </div>
    </form>
    {/if}

    {if condition="$list['state'] eq 4"}
    <p class="table_p"></p>
    <form action="" method="post" class="layui-form" id="formcs">
        <input type="hidden" name="withdrawal_id" value="{$list['withdrawal_id']}" class="layui-input">
        <input type="hidden" name="withdrawal_type" value="2" class="layui-input">
        <div class="layui-form-item" style="width: 50%;margin: 0 auto;">
            <button  class="layui-btn" lay-filter="formlog" lay-submit="">重新支付</button>
        </div>
    </form>
    {/if}


    {if condition="$list['log'][0] neq ''"}
    <p class="table_p"></p>
    <table class="layui-table">
        <p class="tis">提现日志</p>
        <tr style="background-color: #f2f2f2;">
            <td>操作内容</td>
            <td>操作时间</td>
            <td>操作人</td>
        </tr>
        {volist name="list['log']" id="vo"}
        <tr>
            <td>{$vo['content']}</td>
            <td>{$vo['add_time']|date="Y-m-d H:i:s",###}</td>
            <td>{$vo['name']}</td>
        </tr>
        {/volist}
    </table>
    {/if}
</div>
{include file="public/footer"/}
<script>
    var phone = $('#dh').text();
    var nPhone = phone.substr(0, 3) + '****' + phone.substring(7, 11);
    $('#dh').text(nPhone);

    $("#dh").click(function(){
        var p = $('#dh').text();
        if(p.indexOf("***") >= 0 ) {
            $('#dh').text({$list['phone']});
        }else {
            var nP = p.substr(0, 3) + '****' + p.substring(7, 11);
            $('#dh').text(nP);
        }
    });


    layui.use(['form','layer'], function(){
        $ = layui.jquery;
        var form = layui.form,layer = layui.layer;

        form.on('submit(formlog)', function(data) {
            var _form = '';
            if ($(this).attr('data-form')) {
                _form = $($(this).attr('data-form'));
            } else {
                _form = $(this).parents('form');
            }

            layer.msg('数据提交中...',{time:500000});
            $.ajax({
                type: "POST",
                url: "{:url('With/examine')}",
                data: _form.serialize(),
                success: function(res) {
                    if (res.code == 200) {
                        layer.msg(res.msg, {time: 1000, icon: 1});

                        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                        parent.layer.close(index);
                        parent.location.reload();
                    } else {
                        layer.msg(res.msg, {time: 1000, icon: 2});
                    }
                }
            });
            return false;
        });
    });
</script>